import { CronJob } from 'cron';
import { logger } from '../common/logger';
import Container from 'typedi';
import { UserService } from '../services/UserService';

const userService: UserService = Container.get(UserService);

const cron = new CronJob('0 0 * * * *', () => {
    try {
        console.debug('Executing cron job once every hour');

        // for example
        // userService.doSomething();
    } catch (err) {
        logger.error('Executing cron job error: ' + err);
    }
});

export { cron };